//
//  fmod_player.hpp
//  AudioProgress
//
//  Created by 赵成峰 on 2018/8/31.
//  Copyright © 2018年 赵成峰. All rights reserved.
//

#ifndef fmod_player_hpp
#define fmod_player_hpp

#include <stdio.h>
#include "fmod.hpp"

//Player
typedef struct FPlayer
{
    FMOD_SYSTEM *system;
    FMOD_SOUND *sound;
    FMOD_CHANNEL *channel;
    FMOD_CHANNELGROUP *channelGroup;
    FMOD_DSP *dsp;
    float volume;
    int flag;
} FPlayer;

//初始化
int play_init(FPlayer **play);

//播放音频
int play_start(FPlayer *play, const char *name, int flag);
int play_ready(FPlayer *play, const char *name);
//设置音调
void play_set_pitch(FPlayer *play, float pitch);
void play_set_style(FPlayer *play, int flag);
//设置音量
int play_set_volume(FPlayer *play,float n);
//保存音频
int play_save(FPlayer *play, const char *name,const char *outname, float pitch);
int play_save_volume(FPlayer *play, const char *name,const char *outname, float volume);
int play_save_style(FPlayer *play, const char *name,const char *outname, int flag);

//暂停或恢复 type =1 暂停 0恢复
int play_continue_pause(FPlayer *play,int type);
//关闭 释放资源
void play_close(FPlayer *play);
//停止播放
int play_stop(FPlayer *play);
//是否正在播放
bool play_is_playing(FPlayer *play);
//获取当前播放位置
int play_get_current_pos(FPlayer *play);
//获取总时长
int play_get_total_seconds(FPlayer *play);
int play_get_total_seconds(FPlayer *play, const char *name);
//设置当前播放位置
int play_set_current_pos(FPlayer *play,unsigned int position);
#endif /* fmod_player_hpp */
